package routers

import (
	"myRbac/controllers/deptController"
	middleware "myRbac/middlewares"

	"github.com/gin-gonic/gin"
)

func DeptApi(r *gin.RouterGroup) {
	var dept deptController.DeptController
	userRouter := r.Group("/dept", middleware.JWTAuthPlus())
	{
		userRouter.GET("/", dept.QueryDepts)
		userRouter.GET("/:id", dept.QueryDeptById)
		userRouter.POST("/", dept.AddDept)
		userRouter.PUT("/", dept.UpdateDept)
		userRouter.DELETE("/", dept.DeleteDept)
		userRouter.GET("/subset/:id", dept.QueryDeptSubset)
		userRouter.GET("/tree", dept.QueryDeptTree)
		userRouter.GET("/upper/:id", dept.QueryDeptUpper)
	}
}
